package com.kimastrom.theGame;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;

import com.kimastrom.theGame.Controll.MasterController;
import com.kimastrom.theGame.View.MapListMenu;


public class MainActivity extends Activity {
    MasterController mGame;
    MapListMenu mMapMenu;
    ListView mapList;
    Button StartButton;
    Button ExitButton;
    
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN );
        setContentView(R.layout.startmenu);
        StartButton = (Button) findViewById(R.id.start);
        StartButton.setOnClickListener(mStartButtonListener);
        ExitButton = (Button) findViewById(R.id.exit);
        
        ExitButton.setOnClickListener(new View.OnClickListener() {
        	public void onClick(View v) {
        		exitGame();
        	}
        });
    }
    
    private OnClickListener mStartButtonListener = new OnClickListener() {
        public void onClick(View v) {
          //startGame();
        	//mMapMenu = new MapListMenu();
        	//setContentView(mMapMenu);
        	Intent mapMenuIntent = new Intent(MainActivity.this,com.kimastrom.theGame.View.MapListMenu.class);
            startActivity(mapMenuIntent);
        }
    };

    
    public boolean onCreateOptionsMenu(Menu menu) {
    	super.onCreateOptionsMenu(menu);
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.layout.omenu, menu);
        return true;
    }

    public void startGame() {
    	try {
			mGame = new MasterController(this,2);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	 setContentView(mGame);
    }
    
    public void exitGame() {
    	this.finish();
    }
    
}